package com.yc.entities;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 试纸批号表
 * </p>
 *
 * @author kuakha
 * @since 2021-04-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="BloodSugarArticleTry对象", description="试纸批号表")
public class BloodSugarArticleTry extends Model<BloodSugarArticleTry> {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "试纸批次号主键id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "院长id")
    @NotNull(message = "院长id不能为空")
    private Integer deanId;

    @ApiModelProperty(value = "试纸批次号")
    @NotBlank(message = "试纸批次号不能为空")
    private String articleTry;

    @ApiModelProperty(value = "对应科室id")
    @NotNull(message = "科室id不能为空")
    private Integer departmentId;

    @ApiModelProperty(value = "对应user表 操作人")
    @NotNull(message = "用户id不能为空")
    private Integer userId;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "生产日期")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
    @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME)
    private Date dateInProduced;

    @ApiModelProperty(value = "使用期限")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
    @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME)
    private Date liveTime;

    @ApiModelProperty(value = "操作时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
    @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME)
    @TableField(value = "add_time",fill = FieldFill.INSERT)
    private LocalDateTime addTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
